package com.qyhl.webtv.module_news.news.union.town2;


import com.qyhl.webtv.commonlib.entity.news.UnionBean;

import java.util.List;

/**
 * Created by qyhl on 2018/2/26.
 */

public class Town2ListPresenter implements Town2ListContract.Town2ListPresenter {
    private Town2ListModel mModel;
    private Town2ListContract.Town2ListView mView;

    public Town2ListPresenter(Town2ListContract.Town2ListView mView) {
        this.mView = mView;
        this.mModel = new Town2ListModel(this);
    }

    @Override
    public void getData(String section) {
        mModel.getData(section);
    }

    @Override
    public void setData(List<UnionBean> beanList) {
        mView.setData(beanList);
    }

    @Override
    public void setError(int code, String msg) {
        switch (code) {
            case 0:
                mView.setNetError(msg);
                break;
            case 1:
                mView.setError(msg);
                break;
            case 2:
                mView.setEmpty(msg);
                break;
            default:
                break;
        }
    }
}
